home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / gfx / show / GS510_data.lha / ghostscript / 5.10 / gs_init.ps < prev    next >
Text File  |  1997-12-28  |  46KB  |  1,459 lines

  1. %    Copyright (C) 1989, 1996, 1997 Aladdin Enterprises.  All rights reserved.
  2. % This file is part of Aladdin Ghostscript.
  3. % Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  4. % or distributor accepts any responsibility for the consequences of using it,
  5. % or for whether it serves any particular purpose or works at all, unless he
  6. % or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  7. % License (the "License") for full details.
  8. % Every copy of Aladdin Ghostscript must include a copy of the License,
  9. % normally in a plain ASCII text file named PUBLIC.  The License grants you
  10. % the right to copy, modify and redistribute Aladdin Ghostscript, but only
  11. % under certain conditions described in the License.  Among other things, the
  12. % License requires that the copyright notice and this notice be preserved on
  13. % all copies.
  14.  
  15. % Initialization file for the interpreter.
  16. % When this is run, systemdict is still writable.
  17.  
  18. % Comment lines of the form
  19. %    %% Replace <n> <file(s)>
  20. % indicate places where the next <n> lines should be replaced by
  21. % the contents of <file(s)>, when creating a single merged init file.
  22.  
  23. % The interpreter can call out to PostScript code.  All procedures
  24. % called in this way, and no other procedures defined in these
  25. % initialization files, have names that begin with %, e.g.,
  26. % (%Type1BuildChar) cvn.
  27.  
  28. % Check the interpreter revision.  NOTE: the interpreter code requires
  29. % that the first non-comment token in this file be an integer.
  30. 510
  31. dup revision ne
  32.  { (gs: Interpreter revision \() print revision 10 string cvs print
  33.    (\) does not match gs_init.ps revision \() print 10 string cvs print
  34.    (\).\n) print flush null 1 .quit
  35.  }
  36. if pop
  37.  
  38. % Acquire userdict, and set its length if necessary.
  39. /userdict where
  40.  { pop userdict maxlength 0 eq }
  41.  { true }
  42. ifelse
  43.  {        % userdict wasn't already set up by iinit.c.
  44.    /userdict
  45.    currentdict dup 200 .setmaxlength        % userdict
  46.    systemdict begin def        % can't use 'put', userdict is local
  47.  }
  48.  { systemdict begin
  49.  }
  50. ifelse
  51.  
  52. % Define dummy local/global operators if needed.
  53. systemdict /.setglobal known
  54.  { true .setglobal
  55.  }
  56.  { /.setglobal { pop } bind def
  57.    /.currentglobal { false } bind def
  58.    /.gcheck { pop false } bind def
  59.  }
  60. ifelse
  61.  
  62. % Define .languagelevel if needed.
  63. systemdict /.languagelevel known not { /.languagelevel 1 def } if
  64.  
  65. % Optionally choose a default paper size other than U.S. letter.
  66. % (a4) /PAPERSIZE where { pop pop } { /PAPERSIZE exch def } ifelse
  67.  
  68. % Turn on array packing for the rest of initialization.
  69. true setpacking
  70.  
  71. % Define the old MS-DOS EOF character as a no-op.
  72. % This is a hack to get around the absurd habit of MS-DOS editors
  73. % of adding an EOF character at the end of the file.
  74. <1a> cvn { } def
  75.  
  76. % Acquire the debugging flags.
  77. currentdict /DEBUG known   /DEBUG exch def
  78.   /VMDEBUG
  79.     DEBUG {{print mark
  80.             systemdict /level2dict known
  81.          { .currentglobal dup false .setglobal vmstatus
  82.            true .setglobal vmstatus 3 -1 roll pop
  83.            6 -2 roll pop .setglobal
  84.          }
  85.          { vmstatus 3 -1 roll pop
  86.          }
  87.         ifelse usertime 16#fffff and counttomark
  88.           { ( ) print (           ) cvs print }
  89.         repeat pop
  90.         ( ) print systemdict length (    ) cvs print
  91.         ( ) print countdictstack (  ) cvs print
  92.         ( <) print count (  ) cvs print (>\n) print flush
  93.       }}
  94.       {{pop
  95.       }}
  96.      ifelse
  97.   def
  98.  
  99. currentdict /BATCH known   /BATCH exch def
  100. currentdict /DELAYBIND known   /DELAYBIND exch def
  101. currentdict /DISKFONTS known   /DISKFONTS exch def
  102. currentdict /ESTACKPRINT known   /ESTACKPRINT exch def
  103. currentdict /FAKEFONTS known   /FAKEFONTS exch def
  104. currentdict /FIXEDMEDIA known   /FIXEDMEDIA exch def
  105. currentdict /FIXEDRESOLUTION known   /FIXEDRESOLUTION exch def
  106. currentdict /LOCALFONTS known   /LOCALFONTS exch def
  107. currentdict /NOBIND known   /NOBIND exch def
  108. /.bind /bind load def
  109. NOBIND { /bind { } def } if
  110. currentdict /NOCACHE known   /NOCACHE exch def
  111. currentdict /NOCIE known   /NOCIE exch def
  112. currentdict /NODISPLAY known   not /DISPLAYING exch def
  113. currentdict /NOFONTMAP known   /NOFONTMAP exch def
  114. currentdict /NOFONTPATH known   /NOFONTPATH exch def
  115. currentdict /NOGC known   /NOGC exch def
  116. currentdict /NOPAUSE known   /NOPAUSE exch def
  117. currentdict /NOPLATFONTS known   /NOPLATFONTS exch def
  118. currentdict /NOPROMPT known   /NOPROMPT exch def
  119. % The default value of ORIENT1 is true, not false.
  120. currentdict /ORIENT1 known not { /ORIENT1 true def } if
  121. currentdict /OSTACKPRINT known   /OSTACKPRINT exch def
  122. currentdict /OUTPUTFILE known    % obsolete
  123.  { /OutputFile /OUTPUTFILE load def
  124.    currentdict /OUTPUTFILE .undef
  125.  } if
  126. currentdict /QUIET known   /QUIET exch def
  127. currentdict /SAFER known   /SAFER exch def
  128. currentdict /SHORTERRORS known   /SHORTERRORS exch def
  129. currentdict /WRITESYSTEMDICT known   /WRITESYSTEMDICT exch def
  130.  
  131. % Acquire environment variables.
  132. currentdict /DEVICE known not
  133.  { (GS_DEVICE) getenv { /DEVICE exch def } if } if
  134.  
  135. (START) VMDEBUG
  136.  
  137. % Open the standard files, so they will be open at the outermost save level.
  138. (%stdin) (r) file pop
  139. (%stdout) (w) file pop
  140. (%stderr) (w) file pop
  141.  
  142. % Define a procedure for skipping over an unneeded section of code.
  143. % This avoids allocating space for the skipped procedures.
  144. % We can't use readline, because that imposes a line length limit.
  145. /.skipeof    % <string> .skipeof -
  146.  { currentfile exch 1 exch .subfiledecode flushfile
  147.  } bind def
  148.  
  149. % If we're delaying binding, remember everything that needs to be bound later.
  150. DELAYBIND NOBIND not and
  151.  { .currentglobal false .setglobal
  152.    userdict /.delaybind 1500 array put
  153.    .setglobal
  154.    userdict /.delaycount 0 put
  155.     % When we've done the delayed bind, we want to stop saving.
  156.     % Detect this by the disappearance of .delaybind.
  157.    /bind
  158.     { userdict /.delaybind .knownget
  159.        { .delaycount 2 index put
  160.          userdict /.delaycount .delaycount 1 add put
  161.        }
  162.        { .bind
  163.        }
  164.       ifelse
  165.     } bind def
  166.  } if
  167.  
  168. % Define procedures to assist users who don't read the documentation.
  169. userdict begin
  170. /help
  171.  { (Enter PostScript commands.  '(filename) run' runs a file, 'quit' exits.\n)
  172.    print flush
  173.  } bind def
  174. /? /help load def
  175. end
  176.  
  177. % Define =string, which is used by some PostScript programs even though
  178. % it isn't documented anywhere.
  179. % Put it in userdict so that each context can have its own copy.
  180. userdict /=string 256 string put
  181.  
  182. % Print the greeting.
  183.  
  184. /printgreeting
  185.  { mark
  186.    product (Ghostscript) search
  187.     { pop pop pop
  188.       (This software comes with NO WARRANTY: see the file PUBLIC for details.\n)
  189.     }
  190.     { pop
  191.     }
  192.    ifelse
  193.    (\n) copyright
  194.    (\)\n) revisiondate 100 mod (-)
  195.    revisiondate 100 idiv 100 mod (-)
  196.    revisiondate 10000 idiv ( \()
  197.    revision 10 mod
  198.    revision 100 mod dup 0 ne { 10 idiv } { pop } ifelse (.)
  199.    revision 100 idiv ( )
  200.    product
  201.    counttomark
  202.     { (%stdout) (w) file exch false .writecvp
  203.     } repeat pop
  204.  } bind def
  205.  
  206. QUIET not { printgreeting flush } if
  207.  
  208. % Define a special version of def for making operator procedures.
  209. /odef        % <name> <proc> odef -
  210.  { 1 index exch .makeoperator def
  211.  } .bind def
  212.  
  213. %**************** BACKWARD COMPATIBILITY
  214. /getdeviceprops
  215.  { null .getdeviceparams
  216.  } bind odef
  217. /.putdeviceprops
  218.  { null true counttomark 1 add 3 roll .putdeviceparams
  219.    dup type /booleantype ne
  220.     { dup mark eq { /unknown /rangecheck } if
  221.       counttomark 4 add 1 roll cleartomark pop pop pop
  222.       /.putdeviceprops load exch signalerror
  223.     }
  224.    if
  225.  } bind odef
  226. /max { .max } bind def
  227. /min { .min } bind def
  228. /.currentfilladjust { .currentfilladjust2 pop } bind odef
  229. /.setfilladjust { dup .setfilladjust2 } bind odef
  230. /.writecvs { false .writecvp } bind odef
  231.  
  232. % Define predefined procedures substituting for operators,
  233. % in alphabetical order.
  234.  
  235. userdict /#copies 1 put
  236. % Adobe implementations don't accept /[ or /], so we don't either.
  237. ([) cvn
  238.     /mark load def
  239. (]) cvn
  240.     {counttomark array astore exch pop} odef
  241. /abs    {dup 0 lt {neg} if} odef
  242. % .beginpage is redefined if setpagedevice is present.
  243. /.beginpage { } odef
  244. /copypage
  245.     { 1 .endpage
  246.        { .currentnumcopies false .outputpage
  247.          (>>copypage, press <return> to continue<<\n) .confirm
  248.        }
  249.       if .beginpage
  250.     } odef
  251. /countexecstack { false .countexecstack } odef
  252. % .